﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace EStart.Infrastructure.Domain.Events
{
    public class DomainEventPublisher : IDomainEventPublisher
    {
        public void Publish<T>(T domainEvent) where T : IDomainEvent
        {
            DomainEventHandlerFactory
                .GetDomainEventHandlersFor(domainEvent)
                .ForEach(h => h.Handler(domainEvent));
        }
    }
}
